import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { commentActionsDefaultProps } from './defaultProps';
import type { CommentActionsOptions } from './type';

export interface CommentActionsProps extends CommentActionsOptions, HTMLAttributes<HTMLDivElement> {}

const CommentActions: FC<CommentActionsProps> = (props) => {
  const { className, children, forwardedRef, ...commentActionsProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('actions', className), ...commentActionsProps },
    children,
  );
};

CommentActions.displayName = 'CommentActions';
CommentActions.defaultProps = commentActionsDefaultProps;

export default CommentActions;
